<%@page language="java" pageEncoding="UTF-8" %>
<%@page contentType="text/html; charset=utf-8" %>
<%@page import="com.mysql.jdbc.Driver" %>
<%@page import="java.sql.*"%>
<%
request.setCharacterEncoding("UTF-8");

String userName="root";
String userPassword="";
String dbName="a0713225307";

	Class.forName("com.mysql.jdbc.Driver").newInstance();
	String u="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPassword+"&useUnicode=true&characterEncoding=UTF-8";
	
	java.sql.Connection connection=java.sql.DriverManager.getConnection(u,userName,userPassword);
	String sql="select * from mywork_db order by pId desc";
    Statement statement=connection.createStatement();
    ResultSet  rs=statement.executeQuery(sql);
%>
<table id="my-table"style="width:100%;">
<tr style="line-height:50px;border-bottom:2px white solid;"><th  style="text-align:center;">图片</th><th style="text-align:center;">基本信息</th></tr>

<%
while(rs.next()){
%>	
<tr style="height:200px;border-bottom:2px white solid;width:100%;"><td style="padding:20px;"><a target="_blank"><img src="<%=rs.getString(4)%>" title="查看详情" onclick="lookDetail(event)"style="width:150px;height:150px;border:white 2px solid"></a></td>
<td style="width:75%;">
<table class="col-md-12">
<tbody>
<tr style="line-height:50px;width:25%;"><td class="myWork_detail">ID：<%out.print(rs.getString(1));%></td><td rowspan="3"style="width:75%;"><div style="width:80%;height:150px;overflow:hidden">描述：<%out.print(rs.getString(5));%></div></td></tr>
<tr style="line-height:50px;"><td>名称：<%out.print(rs.getString(2));%></td></tr>
<tr style="line-height:50px;"><td>分类：<%out.print(rs.getString(3));%></td></tr>
</tbody>

</table>
</td></tr>
<%	
}
%>

</table>
<%
rs.close();
statement.close();
connection.close();
%>
<script>
function lookDetail(e){
     e=e||window.event;
	e.target=e.target||e.srcElement;
	var p=$(e.target).parent().parent().next().find(".myWork_detail").text();
		p=p.replace("ID：","");
	//alert(p);
$(e.target).parent().attr("href","my/myWork.jsp?ID="+p);
$(e.target).parent().click();
	//var param="una='"+p+"'";
	
	
}
</script>